package com.study.javaBasic.queue;

import java.util.Scanner;

/**
 * @ClassName: CircleArrayDemo
 * @Description: 环形队列
 * @author: 王胜
 * @date 2021/2/22
 * @Version: 1.0
 **/
public class CircleArrayQueueDemo {
    public static void main(String[] args) {
        CircleArrayQueue queue=new CircleArrayQueue(3);

        boolean flag=true;
        Scanner sc=new Scanner(System.in);
        while (flag){
            System.out.println("环形队列测试程序--------");
            System.out.println("a---添加一个元素");
            System.out.println("g---取出一个元素");
            System.out.println("s---展示队列所遇元素");
            System.out.println("h---展示队首元素");
            System.out.println("e---退出");
            String s = sc.nextLine();
            switch (s){
                case "a":
                    System.out.println("请输入一个数");
                    queue.addQueue(sc.nextInt());
                    break;
                case "g":
                    System.out.println(queue.getQueue());
                    break;
                case "s":
                    queue.showQueue();
                    break;
                case "h":
                    System.out.println(queue.showFront());
                    break;
                case "e":
                    flag=false;
                    break;
                default:break;
            }
        }
    }

}